import { ChartSequenceConfig } from './sequence/chartsequenceconfig.js';
import { ChartPieConfig } from './pie/chartpieconfig.js';

export class ChartConfigFactory {
    static configClasses = new Map([
        ['sequence', ChartSequenceConfig],
        ['pie', ChartPieConfig]
    ]);

    static createConfig(chartType, container, options) {
        const ConfigClass = this.configClasses.get(chartType);
        if (!ConfigClass) {
            throw new Error(`不支持的图表类型: ${chartType}`);
        }
        return new ConfigClass(container, options);
    }

    static registerConfigClass(chartType, ConfigClass) {
        this.configClasses.set(chartType, ConfigClass);
    }
}